(module product (lib "eopl.ss" "eopl")
  (provide product)
  
;;1.20
;;product: sos1 sos2 ==> list
;;usage: (product sos1 sos2)
;;produces: Given 2 lists of symbols each of which have no repetions,  this procedure returns the list of 2-lists which is a cartesian product of the two lists. 

;;examples: 
;;(product '(a b c) '(x y))

(define product 
  (lambda (sos1 sos2)
    (cond 
      ((null? sos1) ()) 
      ((null? sos2) ())
      (else (append (prod-help (car sos1) sos2) (product (cdr sos1) sos2)))
      )
    )
  )
   

;;prod-help: s sos ==> 2-list    
;;usage: (prod-help s sos)
;;produces: Given a symbol and a list of symbols ,  this produces a list with 2-lists , with first  value being the symbl and the second value being the symb in the list.

;;examples:
;;(prod-help 'a '(x y z)) ==> ((a x) (a y) (a z))
(define prod-help
  (lambda (s sos)
    (cond 
      ((null? sos) ())
      (else (cons (list s (car sos)) (prod-help s (cdr sos))))
      )
    )
  )
 

(product '(a b c) '(x y))
)